package com.cmw.auntapp.core.base;

import android.content.Context;
import android.text.TextUtils;

import com.cmw.auntapp.core.util.SharedPreferencesUtil;

import static com.cmw.auntapp.constant.Constant.USER_RNAME_KEY;
import static com.cmw.auntapp.constant.Constant.USER_USERAUTHTOKEN_KEY;

/**
 * @desc: 持久化接口类
 * @author: chengmingwei
 * @date: 2021/4/28 7:04 PM
 * @contact: phone(微信同号):13922111489 / email: 340360491@qq.com
 */
public interface IPresenter {
    /**
     *  获取 context 对象
     * @return 返回context 对象
     */
    Context getContext();
    /**
     * 是否实名认证
     * @return 返回Boolean值[true:已实名认证,false:未实名]
     */
    default boolean isRealAuth() {
       String userRname = SharedPreferencesUtil.getInstance(getContext()).getString(USER_RNAME_KEY);
        return (TextUtils.isEmpty(userRname)) ? false : true;
    }

    /**
     * 是否登录
     * @return 返回Boolean值[true:已登录,false:未登录]
     */
    default boolean isLogin() {
        String userRname = SharedPreferencesUtil.getInstance(getContext()).getString(USER_USERAUTHTOKEN_KEY);
        return (TextUtils.isEmpty(userRname)) ? false : true;
    }
}
